<?php
include('../config.php');
$username = $_POST['username'];
$password = $_POST['pwd'];
$sge = $_POST['age'];


$sql = "select * from users where username = '$username'";
$res = mysql_query($sql);
$len = mysql_num_rows($res);
if($len>0){
    echo "<meta charset='utf-8'>";
    echo '已被注册,请更换一个再次尝试，<a href="../../../html/register.html">返回</a>';
}else{
    $sql_reg = "insert into users(username,password,age) values ('$username','$password','$age')";
    $res_reg = mysql_query($sql_reg);
    echo "<meta charset='utf-8'>";
if ($res_reg) {
  echo '注册成功，去<a href="../../../html/login.html">登录</a>';
} else {
  echo '注册失败，<a href="../../../html/register.html">返回</a>';
}
}
?>
